import axios from 'axios'
const deatilslist = {
  state: {
    datalist: null,
  },
  mutations: {
    list (state, data) {
      state.datalist = data
    },
    clear (state) {
      state.datalist = null
    },
  },
  actions: {
    getlist (Store, id) {
      axios({
        method: 'get',
        url: '/deatilist.json',
      })
        .then(res => {
          const datalist = res.data[id]
          // const datalist = res.data
          console.log('拿到数据', datalist)
          Store.commit('list', datalist)
        })
    },
  },

}

export default deatilslist
